package nuist.hanniko.stu.webbackend.service.impls;

import com.alibaba.fastjson.JSONArray;
import nuist.hanniko.stu.webbackend.dao.redis.RealTimeRecordDAO;
import nuist.hanniko.stu.webbackend.model.LwM2m.LwM2MResourceValue;
import nuist.hanniko.stu.webbackend.service.DeviceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

import java.util.Date;
import java.util.List;

@Component
public class RedisRecordServiceImpl implements DeviceRecordService {

    @Autowired
    private RealTimeRecordDAO realTimeRecordDAO;

    @Override
    public JSONArray getResourceRecord(String deviceId, String objectId, String resourceId) {
        return realTimeRecordDAO.getResource(deviceId, objectId, resourceId);
    }

    @Override
    public JSONArray getObjectRecord(String deviceId, String objectId) {
        return realTimeRecordDAO.getObject(deviceId, objectId);
    }

    @Override
    public JSONArray getDeviceRecord(String deviceId) {
        return realTimeRecordDAO.getDevice(deviceId);
    }

    @Override
    public int addRecord(LwM2MResourceValue value) {
        throw new NotImplementedException();
    }

    @Override
    public int addRecord(List<LwM2MResourceValue> valueList) {
        throw new NotImplementedException();
    }
}
